import 'package:flutter/material.dart';
import 'package:xview/components/xTabSwiper/XTabSwiper.dart';
import 'package:xview/components/xNavbar.dart';
import 'package:xview/utils/dimension.dart';

class tabsSwiper extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _tabsSwiperState();
  }
}

class _tabsSwiperState extends State<tabsSwiper> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: XNavbar(
        title: '滑动选项卡'
      ).render(context),
      body: Container(
        child: XTabSwiper(
          list: [
            {'title':'page1','color':0xff303133},
            {'title':'page2','color':0xff303133},
            {'title':'page3','color':0xff303133},
          ],
          itemBuilder: (context,index){
            return Container(
              width: Dimension(context).toVw(100),
              padding: EdgeInsets.all(Dimension(context).toPx(16)),
              child: ListView(
                children: [
                  Center(
                    child: Text('page-${index+1}'),
                  ),
                ],
              ),
            );
          },
        ),
      ),
    );
  }
}
